//
// Created by mongobaba on 2021/6/8.
//

#include "unit_test.h"
#include "json_validator.h"

// 解析成功
TEST(json_validator_validate_true) {
    const char* str = R"({"name":"name", "age":10})";
    std::string json(str);
    ASSERT_EQ(true, json_validator::validate(str));
    ASSERT_EQ(true, json_validator::validate(json));
}

// 解析失败
TEST(json_validator_validate_false) {
    const char* str = R"({"name":"name" "age":10})";
    std::string json(str);
    ASSERT_EQ(false, json_validator::validate(str));
    ASSERT_EQ(false, json_validator::validate(json));
}

// 解析失败
TEST(json_validator_validate_null) {
    ASSERT_EQ(false, json_validator::validate(nullptr));
}
